{{ include ("Index/Header.html") }}

<!-- END Navigation -->
<!-- Search -->
<div class="content">
    <div class="input-group">
        <input type="text" class="form-control search-order-keyword" style="padding: 15px;"
               placeholder="{{ i18n("输入订单号进行查询")|raw }}">
        <span class="input-group-text search-order-btn">
                <i class="fa fa-fw fa-search"></i>
              </span>
    </div>
</div>
<!-- END Search -->

<!-- Page Content -->
<div class="content">
    <!-- Results -->
    <div class="block block-rounded overflow-hidden">

        <div class="block-content tab-content overflow-hidden">
            {% if order %}

                {% if  user is null %}

                <!-- Projects -->
                <div class="alert alert-warning alert-dismissible" role="alert">
                    <h3 class="alert-heading h4 my-2">{{ i18n("安全提醒")|raw }}</h3>
                    <p class="mb-0">
                        {{ i18n("您目前以访客模式浏览，订单信息将临时保存于浏览器并仅显示一笔订单。为保障订单永久保存，请")|raw }}<a class="alert-link" href="/login" target="_blank">{{ i18n("注册或登录")|raw }}</a>。
                    </p>
                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
               {% endif %}
                <div>
                        <div class="order-card">
                            <div class="order-header">
                                <h3>{{ i18n("订单号")|raw }}: {{ order.trade_no }}</h3>
                            </div>
                            <div class="order-body">
                                <div class="order-info">
                                    <span>{{ i18n("订单金额")|raw }}: {{ ccy() }}{{ order.total_amount }}</span>
                                    {% if order.pay_order is defined and  order.pay_order is not null and order.pay_order.pay is not null %}

                                    <span class="order-pay-type">{{ i18n("支付方式")|raw }}:
                                        <img src="{{ order.pay_order.pay.icon }}"><pay>{{ order.pay_order.pay.name }}</pay>
                                    </span>
                                    {% endif %}
                                    <span>{{ i18n("支付状态")|raw }}: {{ order_status(order.status)|raw }}</span>
                                    <span>{{ i18n("下单时间")|raw }}: {{ order.create_time }}</span>
                                    <span>{{ i18n("支付时间")|raw }}: {{ order.pay_time is not null ? order.pay_time : "-" }}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table class="table table-striped table-vcenter table-responsive">
                        <thead>
                        <tr>
                            <th>{{ i18n("物品列表")|raw }}</th>
                            <th class="d-none d-lg-table-cell text-center">{{ i18n("状态")|raw }}</th>
                            <th class="d-none d-lg-table-cell text-center" style="width: 15%;">{{ i18n("数量")|raw }}</th>
                            <th class="d-none d-lg-table-cell text-center" >{{ i18n("金额")|raw }}</th>
                            <th class="d-none d-lg-table-cell text-center" >{{ i18n("售后")|raw }}/{{ i18n("维权")|raw }}</th>
                            <th style="text-align: right" >{{ i18n("宝贝信息")|raw }}</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for item in order.items %}
                            <tr>
                                <td class="item-info flex-container">
                                    <div class="item-logo"><img src="{{ item.item.thumb_url }}"></div>
                                    <div class="item-content">
                                        <div class="item-name">{{ i18n(item.item.name)|raw }}</div>
                                        <div class="item-sku-name">{{ i18n(item.sku.name) }}</div>
                                    </div>
                                </td>
                                <td class="d-none d-lg-table-cell text-center">
                                    {{ order_item_status(item.status,order.status)|raw }}
                                </td>
                                <td class="d-none d-lg-table-cell font-size-xl text-center fw-semibold">{{ item.quantity }}</td>
                                <td class="d-none d-lg-table-cell font-size-xl text-center fw-semibold">{{ ccy() }}{{ item.amount }}</td>
                                <td  class="d-none d-lg-table-cell font-size-xl text-center fw-semibold">
                                    {% if item.status == 0 or item.status == 1 or item.status == 2 %}
                                        <a href="/user/trade/order" type="button" class="btn btn-sm btn-primary"><i class="fa fa-fw fa-xmark me-1"></i>{{ i18n("申请退款")|raw }}</a>
                                    {% else %} - {% endif %}
                                </td>
                                <td  style="text-align: right;padding-right: 0;" data-tradeNo="{{ order.trade_no }}" data-id="{{ item.id }}">
                                    {% if item.status == 1 or item.status == 3 or item.status == 4 %}
                                    <button type="button" class="btn btn-sm btn-success  btn-treasure-show"><i class="fa fa-fw fa-hand me-1"></i>{{ i18n("查看")|raw }}</button>
                                        {% if item.render is same as(false) %}
                                            <button type="button" class="btn btn-sm btn-warning btn-treasure-copy"><i class="fa fa-fw fa-copy me-1"></i>{{ i18n("复制")|raw }}</button>
                                            <button type="button" class="btn btn-sm btn-info  btn-treasure-download" style="margin-right: 0;"><i class="fa fa-fw fa-download me-1"></i>{{ i18n("下载")|raw }}</button>
                                        {% endif %}
                                   {% else %}
                                       -
                                    {% endif %}
                                </td>
                            </tr>
                       {% endfor %}
                        </tbody>
                    </table>

            {% else %}
                <div style="margin: 20px auto 30px auto;text-align: center;">{{ i18n("暂无订单")|raw }}</div>
            {% endif %}
        </div>
    </div>
    <!-- END Results -->


</div>
<!-- END Page Content -->
{{ ready("/assets/user/controller/index/search.js")|raw }}
{{ include ("Index/Footer.html") }}